<template>
	<view class="card-default">
		<view class="card-header">
			<view class="avatar-container">
				<image :src="cardInfo.avatar" class="avatar" mode="widthFix"></image>
			</view>
			<view class="name-container">
				<view class="name">{{ cardInfo.name }}</view>
				<view class="title">{{ cardInfo.title }}</view>
				<view class="company">{{ cardInfo.company }}</view>
			</view>
		</view>
		<view class="card-body">
			<view class="contact-item">
				<text class="icon">📞</text>
				<text class="content">{{ cardInfo.phone }}</text>
			</view>
			<view class="contact-item">
				<text class="icon">✉️</text>
				<text class="content">{{ cardInfo.email }}</text>
			</view>
			<view class="contact-item">
				<text class="icon">📍</text>
				<text class="content">{{ cardInfo.address }}</text>
			</view>
		</view>
		<view class="card-footer">
			<image :src="cardInfo.qrcode" class="qrcode" mode="widthFix"></image>
			<text class="qrcode-text">扫码联系我</text>
		</view>
	</view>
</template>

<script setup>
	// const cdStore = cardStore()
	// // 状态管理L
	// const {
	// 	templateInfo,
	// 	cardInfo
	// } = cdStore

	const props = defineProps({
		cardInfo: {
			type: Object,
			default: () => ({
				name: '张三default',
				title: '总经理',
				company: '深圳市惠森信息科技有限公司',
				phone: '15013869352',
				email: 'asdf@test.com',
				address: '同乐村',
				avatar: 'https://picsum.photos/id/1005/200/200',
				qrcode: 'https://picsum.photos/id/237/100/100'
			})
		}
	})
</script>

<style scoped>
	.card-default {
		width: 600rpx;
		border-radius: 16rpx;
		box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.1);
		overflow: hidden;
		background-color: white;
	}

	.card-header {
		display: flex;
		padding: 30rpx;
		background-color: #f5f7fa;
		align-items: center;
	}

	.avatar-container {
		width: 140rpx;
		height: 140rpx;
		border-radius: 50%;
		overflow: hidden;
		border: 4rpx solid white;
	}

	.avatar {
		width: 100%;
		height: 100%;
	}

	.name-container {
		margin-left: 30rpx;
	}

	.name {
		font-size: 40rpx;
		font-weight: bold;
		color: #333;
	}

	.title {
		font-size: 28rpx;
		color: #666;
		margin-top: 5rpx;
	}

	.company {
		font-size: 26rpx;
		color: #999;
		margin-top: 5rpx;
	}

	.card-body {
		padding: 20rpx 30rpx;
	}

	.contact-item {
		display: flex;
		align-items: center;
		padding: 15rpx 0;
		border-bottom: 1px solid #f1f1f1;
	}

	.contact-item:last-child {
		border-bottom: none;
	}

	.icon {
		font-size: 32rpx;
		color: #007aff;
		width: 40rpx;
	}

	.content {
		font-size: 28rpx;
		color: #333;
		margin-left: 20rpx;
	}

	.card-footer {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 20rpx;
		background-color: #f5f7fa;
	}

	.qrcode {
		width: 120rpx;
		height: 120rpx;
	}

	.qrcode-text {
		font-size: 24rpx;
		color: #666;
		margin-top: 10rpx;
	}
</style>